﻿namespace Cordyceps.Elastic.Tool.Options;

public class ElasticsearchOptions
{
    /// <summary>
    /// 启用线程池监控
    /// </summary>
    public bool EnableThreadPoolMonitoring = true;

    /// <summary>
    /// 节点地址列表 (必填)
    /// 格式: ["http://node1:9200", "http://node2:9200"]
    /// </summary>
    public required List<Uri> Nodes { get; set; }

    /// <summary>
    /// 默认索引名称 (可选)
    /// </summary>
    public string? DefaultIndex { get; set; }

    /// <summary>
    /// 认证配置
    /// </summary>
    public AuthenticationOptions? Authentication { get; set; }

    /// <summary>
    /// 连接池类型 (默认: Static)
    /// 可选: Static | Sniffing | Sticky | Cloud
    /// </summary>
    public ConnectionPoolType PoolType { get; set; } = ConnectionPoolType.Static;

    /// <summary>
    /// 云服务ID (仅当PoolType=Cloud时需要)
    /// </summary>
    public string? CloudId { get; set; }

    /// <summary>
    /// 超时配置 (秒)
    /// </summary>
    public TimeoutOptions Timeouts { get; set; } = new();

    /// <summary>
    /// 重试策略配置
    /// </summary>
    public RetryOptions Retry { get; set; } = new();

    /// <summary>
    /// 调试模式配置
    /// </summary>
    public DebugOptions Debug { get; set; } = new();

    /// <summary>
    /// 自定义请求头
    /// </summary>
    public Dictionary<string, string> Headers { get; set; } = new();

    /// <summary>
    /// 是否启用HTTP压缩 (默认: true)
    /// </summary>
    public bool EnableHttpCompression { get; set; } = true;

    /// <summary>
    /// 是否忽略证书验证 (默认: false)
    /// </summary>
    public bool DisableCertificateValidation { get; set; } = false;

    /// <summary>
    /// 最大连接数 (默认: 80)
    /// </summary>
    public int MaxConnections { get; set; } = 80;

    /// <summary>
    /// 代理地址 (可选)
    /// </summary>
    public Uri? Proxy { get; set; }

    /// <summary>
    /// 连接存活时间 (分钟)
    /// </summary>
    public double ConnectionLifetime { get; set; } = 5;
    
}